package com.zmn.oms.services.impl.conf.channel;


import com.zmn.oms.model.entity.conf.channel.ConfOrderChannel;
import com.zmn.oms.model.entity.conf.channel.ConfOrderChannelQuery;
import com.zmn.oms.persistence.interfaces.conf.channel.ConfOrderChannelDao;
import com.zmn.oms.services.interfaces.conf.channel.ConfOrderChannelService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 渠道订单配置表Service实现类
 *
 * @author linfeng
 * @since 2020/10/30 11:45
 */
@Service
public class ConfOrderChannelServiceImpl implements ConfOrderChannelService {

	@Resource
	ConfOrderChannelDao confOrderChannelDao;

	@Override
	public ConfOrderChannel findByKey(Integer channelId) {
		return confOrderChannelDao.findByKey(channelId);
	}

	@Override
	public List<ConfOrderChannel> listPageByQuery(ConfOrderChannelQuery query) {
		int count = countByQuery(query);
		query.setTotalCount(count);
		return confOrderChannelDao.listPageByQuery(query);
	}

	@Override
	public List<ConfOrderChannel> listByQuery(ConfOrderChannelQuery query) {
		return confOrderChannelDao.listByQuery(query);
	}

	@Override
	public List<ConfOrderChannel> listAll() {
		return confOrderChannelDao.listAll();
	}

	@Override
	public Integer countByQuery(ConfOrderChannelQuery query) {
		return confOrderChannelDao.countByQuery(query);
	}

	@Override
	public Integer updateByKey(ConfOrderChannel confOrderChannel) {
		return confOrderChannelDao.updateByKey(confOrderChannel);
	}

	@Override
	public Integer insert(ConfOrderChannel confOrderChannel) {
		return confOrderChannelDao.insert(confOrderChannel);
	}

	@Override
	public Integer deleteByKey(Integer channelId) {
		return confOrderChannelDao.deleteByKey(channelId);
	}

	/**
	 * 根据渠道id集合删除数据
	 *
	 * @param channelIds ID
	 * @return
	 */
	@Override
	public Integer deleteByChannelIds(List<Integer> channelIds){
		return confOrderChannelDao.deleteByChannelIds(channelIds);
	}


	@Override
	public void copy(Integer originalChannelId, int targetChannelId, String operator) {

		confOrderChannelDao.copy(originalChannelId, targetChannelId, operator);
	}

}